package com.kitty.game.function.model;

import com.kitty.game.utils.Const;
import lombok.Getter;
import lombok.Setter;

import java.util.HashSet;
import java.util.Set;

/**玩家功能，对应界面的功能按钮*/
@Setter
@Getter
public class RoleFunction {
    /**已经开启的主界面图标*/
    private Set<Short> icons = new HashSet<Short>();
    /**已经开启的Tab Icons*/
    private Set<Short> tabIcons = new HashSet<Short>();

    /**已经开启的Tab Icons*/
    private Set<Short> icons2 = new HashSet<Short>();

    public Set<Short> getIcons() {
        return icons;
    }

    public Set<Short> getTabIcons() {
        return tabIcons;
    }

    /**是否已经开启功能*/
    public boolean isOpen(short functionId) {
        if (icons.contains(functionId)) {return true;}
        if (tabIcons.contains(functionId)) {return true;}

        return false;
    }

    /**开启功能*/
    public void openFunction(short functionId, byte functionType) {
        if (functionType == Const.ICON_TYPE_MAIN) {
            icons.add(functionId);
        } else if (functionType == Const.ICON_TYPE_TAB) {
            tabIcons.add(functionId);
        } else if (functionType == Const.ICON_TYPE_MAIN2) {
            icons2.add(functionId);
        }
    }
}
